//import java.util.ArrayList;
//import java.util.List;
//import java.util.Scanner;
//
//class Student implements Comparable<Student>{
//    public String name;
//    public int age;
//
//    public Student(String name, int age) {
//        this.name = name;
//        this.age = age;
//    }
//
//    public int compareTo(Student o) {
//        return o.age-this.age;
//    }
//}
//public class test {
//    public static void main(String[] args) {
//        Scanner scanner = new Scanner(System.in);
//        Student s1 = new Student("Tome",18);
//        Student s2 = new Student("Lucky",25);
//        Student s3 = new Student("Mac",19);
//        Student s4 = new Student("York",20);
//        Student s5 = new Student("Pagan",18);
//        List<Student> list = new ArrayList<>();
//        list.add(s1);
//        list.add(s2);
//        list.add(s3);
//        list.add(s4);
//        list.add(s5);
//        String name = scanner.next();
//        int age = scanner.nextInt();
//        Student s = new Student(name,age);
//        System.out.println(name + "is " + age + " years old as:");
//        int flag = 0;
//        for(int i = 0; i<list.size(); i++) {
//            if(list.get(i).compareTo(s)==0) {
//                System.out.println(list.get(i).name);
//                flag = 1;
//            }
//        }
//        System.out.println();
//        if(flag == 0) {
//            System.out.println("nobody");
//        }
//    }
//}

import java.util.HashSet;
import java.util.Iterator;

class Worker {
    private String name;
    private int age;
    private int salary;

    public Worker(String name, int age, int salary) {
        this.name = name;
        this.age = age;
        this.salary = salary;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public int getSalary() {
        return salary;
    }

    public void setSalary(int salary) {
        this.salary = salary;
    }
}
public class test {
    public static void main(String[] args) {
        HashSet<Worker> set = new HashSet<>();
        Worker w1 = new Worker("zhangsan",18,4000);
        Worker w2 = new Worker("lisi",25,4500);
        Worker w3 = new Worker("wangwu",22,4200);
        set.add(w2);
        set.add(w3);
        set.add(w1);
        System.out.println("print1:");
        Iterator<Worker> it = set.iterator();
        while (it.hasNext())  {
            Worker worker = it.next();
            System.out.println(worker.getName()+","+worker.getAge()+","+worker.getSalary());
        }
        System.out.println("print-add:");
        set.add(w3);
        for(Worker worker:set) {
            System.out.println(worker.getName()+","+worker.getAge()+","+worker.getSalary());
        }
        System.out.println("print-del:");
        set.remove(w1);
        for(Worker worker:set) {
            System.out.println(worker.getName()+","+worker.getAge()+","+worker.getSalary());
        }
    }
}
